package com.tanhua.app.controller;

import com.tanhua.app.service.PeachblossomService;
import com.tanhua.model.vo.SoundVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/peachblossom")
public class PeachblossomController {

    @Autowired
    private PeachblossomService peachblossomService;

    //桃花传音发送语音
    @PostMapping
    public ResponseEntity sendSound(MultipartFile soundFile) throws Exception {
        peachblossomService.sendSound(soundFile);
        return ResponseEntity.ok(null);
    }

    //接收语音
    @GetMapping
    public ResponseEntity receiveSound(){
        SoundVo vo = peachblossomService.receiveSound();
        return ResponseEntity.ok(vo);
    }
}
